stack: Ensure the bin window has an evmask suitable to windowless children
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 11 Aug 2014 14:49:46 +0000 (16:49 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 12 Aug 2014 12:28:34 +0000 (14:28 +0200)
If a child has set_has_window == FALSE, it purely relies on the events set on
the parent window, for which the bin window used to just ensure the exposure
mask, eating all input events.

https://bugzilla.gnome.org/show_bug.cgi?id=734357

gtk/gtkstack.c

index a0c38bbb2b77974cabee92b03d77ca9d91ee572a..144724e4cc84d78e51dd4398e6545f26e5ed1090 100644 (file)
@@ -318,6 +318,12 @@ gtk_stack_realize (GtkWidget *widget)
   attributes.width = allocation.width;
   attributes.height = allocation.height;
 
+  for (l = priv->children; l != NULL; l = l->next)
+    {
+      info = l->data;
+      attributes.event_mask |= gtk_widget_get_events (info->widget);
+    }
+
   priv->bin_window =
     gdk_window_new (priv->view_window, &attributes, attributes_mask);
   gtk_widget_register_window (widget, priv->bin_window);
@@ -1133,6 +1139,11 @@ gtk_stack_add (GtkContainer *container,
   gtk_widget_set_parent_window (child, priv->bin_window);
   gtk_widget_set_parent (child, GTK_WIDGET (stack));
 
+  if (priv->bin_window)
+    gdk_window_set_events (priv->bin_window,
+                           gdk_window_get_events (priv->bin_window) |
+                           gtk_widget_get_events (child));
+
   g_signal_connect (child, "notify::visible",
                     G_CALLBACK (stack_child_visibility_notify_cb), stack);